<?
	class CountryBO extends BusinessObject 
  {
  
	  var $CANADA_NAME   = "Canada";
	  var $USA_NAME      = "United States";

	function setAttributes(){
		$this->fields   = array(
			"id"	=>	'ctrID',
			"name"  =>	'ctrName'
			);

			BusinessObject::setAttributes();
	}

	function CountryBO () {
		BusinessObject::BusinessObject("countries");
		$this->setAttributes();
	}
	
  function getCountryNameByID($id)
  {
    $this->id = $id;
    $this->Load(0,1);
    if($this->Next())
    {
      return $this->name;
    }else
    {
      return "";
    }
  }

  function getCountryIDByName($name)
  {
    $this->name = $name;
    $this->Load(0,1);
    if($this->Next())
    {
      return $this->id;
    }else
    {
      return "";
    }
  }


  function get_country_as_html($sel_countryID){
    $ret = "";
    $this->Load(0,0);    
    while ($this->Next()) 
    {
      $ret.= "<option value='{$this->id}' ".(($sel_countryID==$this->id)?"selected":"").">".htmlspecialchars($this->name)."</option>";
    }
    return $ret;
  }
}
?>